package com.py.credit.service;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.springframework.web.multipart.MultipartFile;

import com.py.credit.entity.BatchFile;
import com.py.credit.entity.BatchLog;
import com.py.credit.entity.Column;
import com.py.credit.entity.SysUser;
import com.py.credit.entity.Table;
import com.py.framework.core.common.Page;

public interface BatchLogService {

	/**
	 * 上传文件
	 * 
	 * @param file
	 *            文件
	 * @param manager
	 *            用户对象
	 * @param tableId
	 *            table id
	 * @param path
	 *            路径
	 * @throws Exception
	 */
	public String doUploadFile(Table table, MultipartFile file, SysUser userInfo, String absolutepath) throws Exception;

	/**
	 * 获取采集批次详情
	 * 
	 * @param batchId
	 * @return
	 */
	public BatchLog selectPermissionLimit(String batchId, SysUser userInfo);

	/**
	 * 原文件下载
	 * 
	 * @param batchId
	 * @param response
	 */
	public void fileDownload(String batchId, HttpServletResponse response, String absolutepath);

	/**
	 * 日志文件下载
	 * 
	 * @param batchId
	 * @param response
	 */
	public void logDownload(String batchId, HttpServletResponse response, String absolutepath);

	/**
	 * 获取当前登录用户的一级部门所绑定的表信息
	 */
	public List<Table> tableForDeptList(Long regionId, Long officeId, String code);

	/**
	 * 获取未处理文件信息
	 * 
	 * @return
	 */
	public List<BatchFile> getUntreatedFiles();

	public void modify(String batchId, String clz);

	public void modifyBatchLog(String batchId, String result, int tcount, int scount, int fcount, int rcount,
			int waitCount, String status);

	public List<Map<String, Object>> getByConditionForPage(List<String> showColumns, String[] additionalColumns,
			String condition, Page page, SysUser userInfo);

	public List<Map<String, Object>> getDoubleByConditionForPage(List<String> showColumns, String[] additionalColumns,
														   String condition, Page page, SysUser userInfo);

	public List<Map<String, Object>> getDoubleFrByConditionForPage(List<String> showColumns, String[] additionalColumns,
																 String condition, Page page, SysUser userInfo);

	public List<Map<String, Object>> getByCondition(String deptId, String condition, List<String> columnENList);

	public List<Map<String, Object>> getErrorDataByConditionForPage(List<String> showColumns,
			String[] additionalColumns, String condition, String deptId, String code, String startTime, String endTime,
			String tableName, Page page, SysUser userInfo);

	public List<Column> getColumnList(int tableId);

	public List<Map<String, Object>> getLogQueryListByConditionForPage(List<String> showColumns,
			String[] additionalColumns, String condition, Page page, SysUser userInfo);

	public Map<String, Object> getLogQueryBieByCondition(String condition, SysUser userInfo);

	public Map<String, Object> getLogQueryBar(String startTime, String endTime);

	public Map<String, Object> selectData(SysUser userInfo, String deptId, String code, String startTime,
			String endTime, String tableName);

	/**
	 * @return
	 */
	public Map<String, Object> getCollectionInfo();

	/**
	 * @return
	 */
	public List<Map<String, Object>> getCollectionAnalysis();

	/**
	 * @return
	 */
	public List<Map<String, Object>> getDeptRkNum();

	/**
	 * 
	 */
	public List<BatchLog> getUnAssociatedBatch();

	/**
	 * @param id
	 */
	public void updateBatchLogAssociationStatus(String id, String status);

	/**
	 * 
	 * @Function 获取入库日志柱状图
	 * @FileName BatchLogService.java
	 * @MethodName logQueryBarView
	 * @param deptId
	 * @return
	 * @Date 2018年5月29日 下午7:02:40
	 * @Author Min DongXv
	 *
	 */
	Map<String, Object> logQueryBarView(SysUser userInfo);

	/**
	 * 
	 * @Function 获取最近5条的数据采集操作
	 * @FileName BatchLogService.java
	 * @MethodName getLastUpload
	 * @param topDeptId
	 *            顶级部门ID
	 * @param regionId
	 *            区域ID
	 * @param deptId
	 *            部门ID
	 * @param userType
	 *            用户类型
	 * @param userId 
	 * @return
	 * @Date 2018年6月22日 下午3:44:46
	 * @Author Min DongXv
	 *
	 */
	List<Map<String, Object>> getLastUpload(Long topDeptId, Long regionId, Long deptId, int userType, Long userId);

	List<Map<String, Object>> getDoubleLastUpload(Long topDeptId, Long regionId, Long deptId, int userType, Long userId);

	List<Map<String, Object>> getDoubleFrLastUpload(Long topDeptId, Long regionId, Long deptId, int userType, Long userId);

	/**
	 * 
	 * @Function 数据采集详情
	 * @FileName BatchLogService.java
	 * @MethodName getBatchDetailForPage
	 * @param columns
	 * @param page
	 * @param userInfo
	 *            当前用户信息
	 * @param tableId
	 *            数据表ID
	 * @return
	 * @Date 2018年6月25日 上午11:52:09
	 * @Author Min DongXv
	 *
	 */
	List<Map<String, Object>> getBatchDetailForPage(List<String> columns, Page page, SysUser userInfo, Integer tableId);

	/**
	 * 
	 * @Function 手工采集
	 * @FileName BatchLogService.java
	 * @MethodName manualCollection
	 * @param data
	 * @param tableId
	 * @param rootId
	 * @return
	 * @Date 2018年6月27日 上午10:53:41
	 * @Author Min DongXv
	 *
	 */
	void manualCollection(String data, Integer tableId, Integer rootId, SysUser userInfo, Integer contentId);

	public void updateBatchLogWaitCount(String batchId, int waitCount);

	boolean isProcessing(String associationType);

	public List<String> getBatchIdByOfficeId(long officeId);

	BatchLog select(String batchId);

	public Map<String, Object> selectTotal(SysUser userInfo);

	public void FrjlAutoPush();

	public void FrcjAutoPush();

	public void ZrrcjAutoPush();

	public void ZrrjlAutoPush();

	
	/**
	 * @Title: UpdateCollectionState
	 * @Description: TODO(这里用一句话描述这个方法的作用)
	 * @param     设定文件
	 * @return void    返回类型
	 * @throws
	*/
	
	public void UpdateCollectionState();

	public List<Map<String, Object>> getTenLastUpload(Long topDeptId, Long regionId, Long deptId, int userType, Long userId);

	public List<Map<String, Object>> getTenByConditionForPage(List<String> showColumns, String[] additionalColumns,
			   String condition, Page page, SysUser userInfo);

}
